package com.konoha.pojo;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.konoha.anno.State;
import jakarta.validation.constraints.NotEmpty;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.groups.Default;
import lombok.Data;
import org.hibernate.validator.constraints.URL;

import java.time.LocalDateTime;

@Data
public class Article {
    @NotNull(groups = Update.class)
    private Integer id;//主键ID

//    @Pattern(regexp = "^\\S{1,15}$")
    private String title;//文章标题

    private String content;//文章内容

    @URL
    private String coverImg;//封面图像
    @State
    private String state;//发布状态 未审核|已审核

    private Integer categoryId;//文章分类id
    private Integer createUser;//创建人ID
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createTime;//创建时间
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateTime;//更新时间
    private String studentId;
    private String name;
    private String score;
    private String timeTaken; // 添加用来存储作答用时的字段

    //如果某个校验项没有指定分组，默认属于Default分组
    //分组之间可以继承，A extends B 那么A中拥有B中所有的校验项
    public interface Add extends Default {

    }

    public interface Update extends Default{

    }
}
